package borderPatrol.Data;

import java.util.HashMap;

import borderPatrol.Calculators.BorderPatrolTreeUpdater;
import borderPatrol.misc.CFRInformationSet;
import borderPatrol.misc.GameTreeBuilder;
import borderPatrol.misc.History;


public class Tester {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		GameTreeBuilder builder = new GameTreeBuilder(new BorderPatrolTreeUpdater());
		
		System.out.println(builder.getGameTree().get("1"));
		System.out.println("*******************");		
		System.out.println(builder.getGameTree().get("1.00"));
		printHistoryProbability(builder.getGameTree().get("1.00"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.01"));
		printHistoryProbability(builder.getGameTree().get("1.01"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.02"));
		printHistoryProbability(builder.getGameTree().get("1.02"), builder.getGameTree());

		System.out.println("*******************");
		System.out.println(builder.getGameTree().get("1.00.10"));
		printHistoryProbability(builder.getGameTree().get("1.00.10"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.01.11"));
		printHistoryProbability(builder.getGameTree().get("1.01.11"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.02.12"));
		printHistoryProbability(builder.getGameTree().get("1.02.12"), builder.getGameTree());
		System.out.println("*******************");
		System.out.println(builder.getGameTree().get("1.00.10.20"));
		printHistoryProbability(builder.getGameTree().get("1.00.10.20"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.01.11.21"));
		printHistoryProbability(builder.getGameTree().get("1.01.11.21"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.01.11.12"));
		printHistoryProbability(builder.getGameTree().get("1.01.11.12"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.01.11.10"));
		printHistoryProbability(builder.getGameTree().get("1.01.11.10"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("1.02.12.22"));
		printHistoryProbability(builder.getGameTree().get("1.02.12.22"), builder.getGameTree());
		System.out.println("-------------------------------------------------");
		System.out.println(builder.getGameTree().get("2"));
		printHistoryProbability(builder.getGameTree().get("2"), builder.getGameTree());
		System.out.println("*******************");		
		System.out.println(builder.getGameTree().get("2.20"));
		printHistoryProbability(builder.getGameTree().get("2.20"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.21"));
		printHistoryProbability(builder.getGameTree().get("2.21"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.22"));
		printHistoryProbability(builder.getGameTree().get("2.22"), builder.getGameTree());
		System.out.println("*******************");
		System.out.println(builder.getGameTree().get("2.20.10"));
		printHistoryProbability(builder.getGameTree().get("2.20.10"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.21.11"));
		printHistoryProbability(builder.getGameTree().get("2.21.11"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.22.12"));
		printHistoryProbability(builder.getGameTree().get("2.22.12"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.22.21"));
		printHistoryProbability(builder.getGameTree().get("2.22.21"), builder.getGameTree());
		System.out.println("*******************");
		System.out.println(builder.getGameTree().get("2.20.10.00"));
		printHistoryProbability(builder.getGameTree().get("2.20.10.00"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.21.11.01"));
		printHistoryProbability(builder.getGameTree().get("2.21.11.01"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.22.12.02"));
		printHistoryProbability(builder.getGameTree().get("2.22.12.02"), builder.getGameTree());
		System.out.println(builder.getGameTree().get("2.22.21.11"));
		printHistoryProbability(builder.getGameTree().get("2.22.21.11"), builder.getGameTree());
		
	}
	
	private static void printHistoryProbability(CFRInformationSet set, HashMap<String, CFRInformationSet> gameTree) {
		for (History history : set.getPossibleHistories()) {
			System.out.print(gameTree.get(history.toString()).getProbabilityOfOccurence() + " ");
		}
		System.out.println();
	}
}
